Release 10.1A: OpenEdge Development:
Programming Interfaces
Reading XML into a temp-table, temp-table buffer, or ProDataSet
The
READ-XML( )method is used for loading data into static or dynamic temp-table, temp-table buffer, and ProDataSet objects from an XML document. Optionally, you can specify an XML Schema to create a Progress definition for a dynamic object or to verify the XML Schema against a static or dynamic object definition.Here is the syntax for
READ-XML( ). The method returnsTRUEorFALSEto indicate whether the operation was successful.
source-typeA
CHARACTERexpression that specifies the source XML document type. Valid values are:“FILE”,“MEMPTR”,“HANDLE”, and“LONGCHAR”.fileA
CHARACTERexpression that specifies the name of a file. You can specify an absolute pathname, a relative pathname (based on the current working directory), or a URL pathname. Valid URL protocols includeFILEandHTTP(theHTTPSprotocol is not supported). Progress verifies that the file exists and is accessible.memptrA
MEMPTRvariable that contains the XML document text. The size of theMEMPTRvariable must match the size of the XML document text.handleA
WEB-CONTEXTsystem handle, X-document object handle, or X-noderef object handle.longcharA
LONGCHARvariable that contains the XML document text.read-modeA
CHARACTERexpression that specifies the mode in which theREAD-XML( )method reads data from the XML document into a temp-table or ProDataSet member buffer. The expression must evaluate to“APPEND”,“EMPTY”,“MERGE”, or“REPLACE”. The default value is"MERGE".Table 22–4 lists the
READ-XML( )method modes for reading data.
schema-locationA
CHARACTERexpression that specifies the name of an external XML Schema file to use in creating or verifying the object’s definition when reading in the XML document. You can specify an absolute pathname, a relative pathname (based on the current working directory), or a URL pathname. Valid URL protocols includeFILEandHTTP(theHTTPSprotocol is not supported). Progress verifies that the file exists and is accessible. When specified, Progress ignores any XML Schema defined or referenced in the source XML document.If you specify the empty string ("") or the Unknown value (
?), Progress creates or verifies the object’s definition using any XML Schema defined or referenced in the XML document.override-default-mappingA
LOGICALexpression whereTRUEdirects Progress to override the default mapping between XML Schema string and binary data types and Progress data types when creating a Progress temp-table schema from an XML Schema. The default value isFALSE.The XML Schema string data type maps to the Progress
CHARACTERdata type by default, and the XML Schemabase64BinaryandhexBinarydata types map to the ProgressRAWdata type by default. If you specifyTRUE, theREAD-XML( )method creates a temp-table schema withCLOBandBLOBfields instead ofCHARACTERandRAWfields.If you specify the Unknown value (
Note: If the temp-table or ProDataSet has a Progress definition, this option is ignored.?), the method uses the default value ofFALSE.field-type-mappingAn optional
CHARACTERexpression that evaluates to a comma-separated list of field name, data type pairs using the following syntax:
This option allows you to specify the Progress data type for a specific field from the XML Schema. Generally, this option is only used to map fields from non-Progress generated schema. When reading and writing Progress-generated XML Schema, there is little need to override field mappings because of the Progress extensions to standard XML Schema.
field-nameThe name of the specified field. For a ProDataSet object, you must qualify the field name with the buffer name from the XML Schema. That is,
buffer-name.field-name.data-typeThe target 4GL data type of the specified field. The data type must be a valid Progress data type, and it must be compatible with the XML Schema type based on the Progress XML data type mapping rules. For example, any XML Schema type can be mapped to a Progress
Note: If the temp-table or ProDataSet has a Progress definition, this option is ignored.CHARorCLOB, but an XML SchemadateTimecan be mapped only to a ProgressDATE,DATETIMEorDATETIME-TZ.If you specify the Unknown value (
?), the method uses the default data type mapping. For more information about the Progress XML data type mapping rules, see Appendix D "XML Reference of Data Type and Code Page mappings."verify-schema-modeAn optional
Note: For a dynamic temp-table or ProDataSet member buffer that does not have a Progress definition (that is, the object is in theCHARACTERexpression that specifies the mode in which theREAD-XML( )method verifies any XML Schema against existing Progress schema. The expression must evaluate to“IGNORE”,“LOOSE”, or“STRICT”. The default value is“LOOSE”.CLEARstate), this option is ignored.
If you specify the Unknown value (
?), the method uses the default value ofLOOSE.If the XML Schema verification fails, the method generates an error message indicating the XML Schema element that caused the failure and returns
FALSE.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |